package com.example.nophase.activity.finance;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Button;
import androidx.appcompat.widget.Toolbar;
import com.example.nophase.Fragment.InstructionsFragment;
import com.example.nophase.R;
import com.example.nophase.base.BaseActivity;
import com.example.nophase.utils.MessageEvent;
import org.greenrobot.eventbus.EventBus;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class InstructionsActivity extends BaseActivity {

    @BindView(R.id.home_toobar)
    Toolbar homeToobar;
    @BindView(R.id.toolbar_btn)
    Button toolbarBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_instructions);

        ButterKnife.bind(this);
        getSupportFragmentManager().
                beginTransaction().
                add(R.id.content_container,
                        InstructionsFragment.newInstance(0)).commit();
        setToolbar();
    }

    private void setToolbar() {
        homeToobar.setNavigationIcon(R.drawable.ic_left_black_24dp);
        homeToobar.setTitle("");

        this.setSupportActionBar(homeToobar);
        getSupportActionBar().setHomeButtonEnabled(true);


    }


    @OnClick(R.id.toolbar_btn)
    public void onViewClicked() {

        EventBus.getDefault().post(new MessageEvent("ok"));
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

            case android.R.id.home:
                this.finish();
                return true;

        }
        return super.onOptionsItemSelected(item);
    }


}
